package com.zjbbkj.baibai.netty.message.sendpackage;

import com.zjbbkj.baibai.common.utils.wanli.SessionIdGeneratorUtils;
import lombok.extern.slf4j.Slf4j;

import static com.zjbbkj.baibai.netty.constants.NettySomeThing.*;

@Slf4j
public class CHD {

    /**
     * 无蜡烛点亮时LED显示屏显示字符设置
     *
     * @param PRAY
     * @return
     */
    public static String CHD_DEVICE(String PRAY) {
        try {
            String type = "CHD";
            String random = SessionIdGeneratorUtils.getRandomStrID();
            String cmd = START + NUM + type + random + "/" + PRAY + "\r\n";
            String length = String.valueOf(cmd.length() + PRAY.length());
            if (length.length() == 2) {
                length = "0" + length;
            }
            cmd = START + length + type + random + "/" + PRAY + "\r\n";
            if (ON_OFF.equals("1")) {
                log.info(cmd);
            }
            return cmd;
        } catch (Exception e) {
            log.info(e.getMessage());
            return "null";
        }
    }
}
